package com.kly.user.enums;

public enum AppCodeEnum {
    MEBOO("sparksy", "com.kly.meboo"),
    MEBOO_IOS("sparksy_ios", "com.kly.meboo"),
    TOUCHU("touchu", "com.kly.touchu"),
    PP("pp", "com.kky.pp"),
    MECHAT("mechat", "com.kly.mechat"),;

    private final String appCode;

    private final String packageName;


    AppCodeEnum(String appCode, String packageName) {
        this.appCode = appCode;
        this.packageName = packageName;
    }

    public String getAppCode() {
        return appCode;
    }

    public String getPackageName() {
        return packageName;
    }

    public static AppCodeEnum fromType(String code) {

        for (AppCodeEnum appCode : values()) {
            if (appCode.getAppCode().equals(code)) {
                return appCode;
            }
        }
        return null;
    }

    public static AppCodeEnum fromPackageName(String packageName) {

        for (AppCodeEnum appCode : values()) {
            if (appCode.getPackageName().equals(packageName)) {
                return appCode;
            }
        }
        return null;
    }
}
